package com.lufei.cardin.controller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import static org.springframework.web.bind.annotation.RequestMethod.GET;

@Controller
@RequestMapping("/config")
@RefreshScope
@Log4j2
public class ConfigController {

//    @NacosValue(value = "${useLocalCache:false}", autoRefreshed = true)
//    private boolean useLocalCache;

//    @RequestMapping(value = "/get", method = GET)
//    @ResponseBody
//    public boolean get() {
//        return useLocalCache;
//    }


    @Value(value = "${desc}")
    private String desc;
    @Value(value = "${hah}")
    private String hah;


    @RequestMapping(value = "/test", method = GET)
    @ResponseBody
    public String test(){
        log.info("desc:{},hah:{}",desc,hah);
        return desc + "-" + hah;
    }
}